package Others.DesignPattern.ObserverPattern.Original.Object;

import lombok.*;
import java.util.HashSet;
import java.util.Set;


@Setter
@Getter
@AllArgsConstructor
public class Proscenium {

    private Set<ColleagueA> colleaguesList;
    private String message;

    public Proscenium(){
        colleaguesList = new HashSet<>();
        message = "";
    }

    public void AddColleague(ColleagueA colleagueA) {
        colleaguesList.add(colleagueA);
    }

    public void DropColleague(ColleagueA colleagueA) {
        colleaguesList.remove(colleagueA);
    }

    public void NotifyColleague() {
        for (ColleagueA colleagueA : colleaguesList) {
            colleagueA.update();
        }
    }

}
